<?php
	/**
	 * This is a MetaControl class, providing a QForm or QPanel access to event handlers
	 * and QControls to perform the Create, Edit, and Delete functionality
	 * of the MantisBugTagTable class.  This code-generated class
	 * contains all the basic elements to help a QPanel or QForm display an HTML form that can
	 * manipulate a single MantisBugTagTable object.
	 *
	 * To take advantage of some (or all) of these control objects, you
	 * must create a new QForm or QPanel which instantiates a MantisBugTagTableMetaControl
	 * class.
	 *
	 * Any and all changes to this file will be overwritten with any subsequent
	 * code re-generation.
	 *
	 * @package My QCubed Application
	 * @subpackage MetaControls
	 * @property-read MantisBugTagTable $MantisBugTagTable the actual MantisBugTagTable data class being edited
	 * @property QIntegerTextBox $BugIdControl
	 * @property-read QLabel $BugIdLabel
	 * @property QIntegerTextBox $TagIdControl
	 * @property-read QLabel $TagIdLabel
	 * @property QIntegerTextBox $UserIdControl
	 * @property-read QLabel $UserIdLabel
	 * @property QIntegerTextBox $DateAttachedControl
	 * @property-read QLabel $DateAttachedLabel
	 * @property-read string $TitleVerb a verb indicating whether or not this is being edited or created
	 * @property-read boolean $EditMode a boolean indicating whether or not this is being edited or created
	 */

	class MantisBugTagTableMetaControlGen extends QBaseClass {
		// General Variables
		/**
		 * @var MantisBugTagTable objMantisBugTagTable
		 * @access protected
		 */
		protected $objMantisBugTagTable;
		/**
		 * @var QForm|QControl objParentObject
		 * @access protected
		 */
		protected $objParentObject;
		/**
		 * @var string strTitleVerb
		 * @access protected
		 */
		protected $strTitleVerb;
		/**
		 * @var boolean blnEditMode
		 * @access protected
		 */
		protected $blnEditMode;

		// Controls that allow the editing of MantisBugTagTable's individual data fields
		/**
		 * @var QIntegerTextBox txtBugId
		 * @access protected
		 */
		protected $txtBugId;
		/**
		 * @var QIntegerTextBox txtTagId
		 * @access protected
		 */
		protected $txtTagId;
		/**
		 * @var QIntegerTextBox txtUserId
		 * @access protected
		 */
		protected $txtUserId;
		/**
		 * @var QIntegerTextBox txtDateAttached
		 * @access protected
		 */
		protected $txtDateAttached;

		// Controls that allow the viewing of MantisBugTagTable's individual data fields
		/**
		 * @var QLabel lblBugId
		 * @access protected
		 */
		protected $lblBugId;
		/**
		 * @var QLabel lblTagId
		 * @access protected
		 */
		protected $lblTagId;
		/**
		 * @var QLabel lblUserId
		 * @access protected
		 */
		protected $lblUserId;
		/**
		 * @var QLabel lblDateAttached
		 * @access protected
		 */
		protected $lblDateAttached;

		// QListBox Controls (if applicable) to edit Unique ReverseReferences and ManyToMany References

		// QLabel Controls (if applicable) to view Unique ReverseReferences and ManyToMany References


		/**
		 * Main constructor.  Constructor OR static create methods are designed to be called in either
		 * a parent QPanel or the main QForm when wanting to create a
		 * MantisBugTagTableMetaControl to edit a single MantisBugTagTable object within the
		 * QPanel or QForm.
		 *
		 * This constructor takes in a single MantisBugTagTable object, while any of the static
		 * create methods below can be used to construct based off of individual PK ID(s).
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this MantisBugTagTableMetaControl
		 * @param MantisBugTagTable $objMantisBugTagTable new or existing MantisBugTagTable object
		 */
		 public function __construct($objParentObject, MantisBugTagTable $objMantisBugTagTable) {
			// Setup Parent Object (e.g. QForm or QPanel which will be using this MantisBugTagTableMetaControl)
			$this->objParentObject = $objParentObject;

			// Setup linked MantisBugTagTable object
			$this->objMantisBugTagTable = $objMantisBugTagTable;

			// Figure out if we're Editing or Creating New
			if ($this->objMantisBugTagTable->__Restored) {
				$this->strTitleVerb = QApplication::Translate('Edit');
				$this->blnEditMode = true;
			} else {
				$this->strTitleVerb = QApplication::Translate('Create');
				$this->blnEditMode = false;
			}
		 }

		/**
		 * Static Helper Method to Create using PK arguments
		 * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
		 * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
		 * static helper methods.  Finally, specify a CreateType to define whether or not we are only allowed to
		 * edit, or if we are also allowed to create a new one, etc.
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this MantisBugTagTableMetaControl
		 * @param integer $intBugId primary key value
		 * @param integer $intTagId primary key value
		 * @param QMetaControlCreateType $intCreateType rules governing MantisBugTagTable object creation - defaults to CreateOrEdit
 		 * @return MantisBugTagTableMetaControl
		 */
		public static function Create($objParentObject, $intBugId = null, $intTagId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
			// Attempt to Load from PK Arguments
			if (strlen($intBugId) && strlen($intTagId)) {
				$objMantisBugTagTable = MantisBugTagTable::Load($intBugId, $intTagId);

				// MantisBugTagTable was found -- return it!
				if ($objMantisBugTagTable)
					return new MantisBugTagTableMetaControl($objParentObject, $objMantisBugTagTable);

				// If CreateOnRecordNotFound not specified, throw an exception
				else if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound)
					throw new QCallerException('Could not find a MantisBugTagTable object with PK arguments: ' . $intBugId . ', ' . $intTagId);

			// If EditOnly is specified, throw an exception
			} else if ($intCreateType == QMetaControlCreateType::EditOnly)
				throw new QCallerException('No PK arguments specified');

			// If we are here, then we need to create a new record
			return new MantisBugTagTableMetaControl($objParentObject, new MantisBugTagTable());
		}

		/**
		 * Static Helper Method to Create using PathInfo arguments
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this MantisBugTagTableMetaControl
		 * @param QMetaControlCreateType $intCreateType rules governing MantisBugTagTable object creation - defaults to CreateOrEdit
		 * @return MantisBugTagTableMetaControl
		 */
		public static function CreateFromPathInfo($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
			$intBugId = QApplication::PathInfo(0);
			$intTagId = QApplication::PathInfo(1);
			return MantisBugTagTableMetaControl::Create($objParentObject, $intBugId, $intTagId, $intCreateType);
		}

		/**
		 * Static Helper Method to Create using QueryString arguments
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this MantisBugTagTableMetaControl
		 * @param QMetaControlCreateType $intCreateType rules governing MantisBugTagTable object creation - defaults to CreateOrEdit
		 * @return MantisBugTagTableMetaControl
		 */
		public static function CreateFromQueryString($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
			$intBugId = QApplication::QueryString('intBugId');
			$intTagId = QApplication::QueryString('intTagId');
			return MantisBugTagTableMetaControl::Create($objParentObject, $intBugId, $intTagId, $intCreateType);
		}



		///////////////////////////////////////////////
		// PUBLIC CREATE and REFRESH METHODS
		///////////////////////////////////////////////

		/**
		 * Create and setup QIntegerTextBox txtBugId
		 * @param string $strControlId optional ControlId to use
		 * @return QIntegerTextBox
		 */
		public function txtBugId_Create($strControlId = null) {
			$this->txtBugId = new QIntegerTextBox($this->objParentObject, $strControlId);
			$this->txtBugId->Name = QApplication::Translate('Bug Id');
			$this->txtBugId->Text = $this->objMantisBugTagTable->BugId;
			$this->txtBugId->Required = true;
			return $this->txtBugId;
		}

		/**
		 * Create and setup QLabel lblBugId
		 * @param string $strControlId optional ControlId to use
		 * @param string $strFormat optional sprintf format to use
		 * @return QLabel
		 */
		public function lblBugId_Create($strControlId = null, $strFormat = null) {
			$this->lblBugId = new QLabel($this->objParentObject, $strControlId);
			$this->lblBugId->Name = QApplication::Translate('Bug Id');
			$this->lblBugId->Text = $this->objMantisBugTagTable->BugId;
			$this->lblBugId->Required = true;
			$this->lblBugId->Format = $strFormat;
			return $this->lblBugId;
		}

		/**
		 * Create and setup QIntegerTextBox txtTagId
		 * @param string $strControlId optional ControlId to use
		 * @return QIntegerTextBox
		 */
		public function txtTagId_Create($strControlId = null) {
			$this->txtTagId = new QIntegerTextBox($this->objParentObject, $strControlId);
			$this->txtTagId->Name = QApplication::Translate('Tag Id');
			$this->txtTagId->Text = $this->objMantisBugTagTable->TagId;
			$this->txtTagId->Required = true;
			return $this->txtTagId;
		}

		/**
		 * Create and setup QLabel lblTagId
		 * @param string $strControlId optional ControlId to use
		 * @param string $strFormat optional sprintf format to use
		 * @return QLabel
		 */
		public function lblTagId_Create($strControlId = null, $strFormat = null) {
			$this->lblTagId = new QLabel($this->objParentObject, $strControlId);
			$this->lblTagId->Name = QApplication::Translate('Tag Id');
			$this->lblTagId->Text = $this->objMantisBugTagTable->TagId;
			$this->lblTagId->Required = true;
			$this->lblTagId->Format = $strFormat;
			return $this->lblTagId;
		}

		/**
		 * Create and setup QIntegerTextBox txtUserId
		 * @param string $strControlId optional ControlId to use
		 * @return QIntegerTextBox
		 */
		public function txtUserId_Create($strControlId = null) {
			$this->txtUserId = new QIntegerTextBox($this->objParentObject, $strControlId);
			$this->txtUserId->Name = QApplication::Translate('User Id');
			$this->txtUserId->Text = $this->objMantisBugTagTable->UserId;
			$this->txtUserId->Required = true;
			return $this->txtUserId;
		}

		/**
		 * Create and setup QLabel lblUserId
		 * @param string $strControlId optional ControlId to use
		 * @param string $strFormat optional sprintf format to use
		 * @return QLabel
		 */
		public function lblUserId_Create($strControlId = null, $strFormat = null) {
			$this->lblUserId = new QLabel($this->objParentObject, $strControlId);
			$this->lblUserId->Name = QApplication::Translate('User Id');
			$this->lblUserId->Text = $this->objMantisBugTagTable->UserId;
			$this->lblUserId->Required = true;
			$this->lblUserId->Format = $strFormat;
			return $this->lblUserId;
		}

		/**
		 * Create and setup QIntegerTextBox txtDateAttached
		 * @param string $strControlId optional ControlId to use
		 * @return QIntegerTextBox
		 */
		public function txtDateAttached_Create($strControlId = null) {
			$this->txtDateAttached = new QIntegerTextBox($this->objParentObject, $strControlId);
			$this->txtDateAttached->Name = QApplication::Translate('Date Attached');
			$this->txtDateAttached->Text = $this->objMantisBugTagTable->DateAttached;
			$this->txtDateAttached->Required = true;
			return $this->txtDateAttached;
		}

		/**
		 * Create and setup QLabel lblDateAttached
		 * @param string $strControlId optional ControlId to use
		 * @param string $strFormat optional sprintf format to use
		 * @return QLabel
		 */
		public function lblDateAttached_Create($strControlId = null, $strFormat = null) {
			$this->lblDateAttached = new QLabel($this->objParentObject, $strControlId);
			$this->lblDateAttached->Name = QApplication::Translate('Date Attached');
			$this->lblDateAttached->Text = $this->objMantisBugTagTable->DateAttached;
			$this->lblDateAttached->Required = true;
			$this->lblDateAttached->Format = $strFormat;
			return $this->lblDateAttached;
		}



		/**
		 * Refresh this MetaControl with Data from the local MantisBugTagTable object.
		 * @param boolean $blnReload reload MantisBugTagTable from the database
		 * @return void
		 */
		public function Refresh($blnReload = false) {
			if ($blnReload)
				$this->objMantisBugTagTable->Reload();

			if ($this->txtBugId) $this->txtBugId->Text = $this->objMantisBugTagTable->BugId;
			if ($this->lblBugId) $this->lblBugId->Text = $this->objMantisBugTagTable->BugId;

			if ($this->txtTagId) $this->txtTagId->Text = $this->objMantisBugTagTable->TagId;
			if ($this->lblTagId) $this->lblTagId->Text = $this->objMantisBugTagTable->TagId;

			if ($this->txtUserId) $this->txtUserId->Text = $this->objMantisBugTagTable->UserId;
			if ($this->lblUserId) $this->lblUserId->Text = $this->objMantisBugTagTable->UserId;

			if ($this->txtDateAttached) $this->txtDateAttached->Text = $this->objMantisBugTagTable->DateAttached;
			if ($this->lblDateAttached) $this->lblDateAttached->Text = $this->objMantisBugTagTable->DateAttached;

		}



		///////////////////////////////////////////////
		// PROTECTED UPDATE METHODS for ManyToManyReferences (if any)
		///////////////////////////////////////////////





		///////////////////////////////////////////////
		// PUBLIC MANTISBUGTAGTABLE OBJECT MANIPULATORS
		///////////////////////////////////////////////

		/**
		 * This will save this object's MantisBugTagTable instance,
		 * updating only the fields which have had a control created for it.
		 */
		public function SaveMantisBugTagTable() {
			try {
				// Update any fields for controls that have been created
				if ($this->txtBugId) $this->objMantisBugTagTable->BugId = $this->txtBugId->Text;
				if ($this->txtTagId) $this->objMantisBugTagTable->TagId = $this->txtTagId->Text;
				if ($this->txtUserId) $this->objMantisBugTagTable->UserId = $this->txtUserId->Text;
				if ($this->txtDateAttached) $this->objMantisBugTagTable->DateAttached = $this->txtDateAttached->Text;

				// Update any UniqueReverseReferences (if any) for controls that have been created for it

				// Save the MantisBugTagTable object
				$this->objMantisBugTagTable->Save();

				// Finally, update any ManyToManyReferences (if any)
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * This will DELETE this object's MantisBugTagTable instance from the database.
		 * It will also unassociate itself from any ManyToManyReferences.
		 */
		public function DeleteMantisBugTagTable() {
			$this->objMantisBugTagTable->Delete();
		}



		///////////////////////////////////////////////
		// PUBLIC GETTERS and SETTERS
		///////////////////////////////////////////////

		/**
		 * Override method to perform a property "Get"
		 * This will get the value of $strName
		 *
		 * @param string $strName Name of the property to get
		 * @return mixed
		 */
		public function __get($strName) {
			switch ($strName) {
				// General MetaControlVariables
				case 'MantisBugTagTable': return $this->objMantisBugTagTable;
				case 'TitleVerb': return $this->strTitleVerb;
				case 'EditMode': return $this->blnEditMode;

				// Controls that point to MantisBugTagTable fields -- will be created dynamically if not yet created
				case 'BugIdControl':
					if (!$this->txtBugId) return $this->txtBugId_Create();
					return $this->txtBugId;
				case 'BugIdLabel':
					if (!$this->lblBugId) return $this->lblBugId_Create();
					return $this->lblBugId;
				case 'TagIdControl':
					if (!$this->txtTagId) return $this->txtTagId_Create();
					return $this->txtTagId;
				case 'TagIdLabel':
					if (!$this->lblTagId) return $this->lblTagId_Create();
					return $this->lblTagId;
				case 'UserIdControl':
					if (!$this->txtUserId) return $this->txtUserId_Create();
					return $this->txtUserId;
				case 'UserIdLabel':
					if (!$this->lblUserId) return $this->lblUserId_Create();
					return $this->lblUserId;
				case 'DateAttachedControl':
					if (!$this->txtDateAttached) return $this->txtDateAttached_Create();
					return $this->txtDateAttached;
				case 'DateAttachedLabel':
					if (!$this->lblDateAttached) return $this->lblDateAttached_Create();
					return $this->lblDateAttached;
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

		/**
		 * Override method to perform a property "Set"
		 * This will set the property $strName to be $mixValue
		 *
		 * @param string $strName Name of the property to set
		 * @param string $mixValue New value of the property
		 * @return mixed
		 */
		public function __set($strName, $mixValue) {
			try {
				switch ($strName) {
					// Controls that point to MantisBugTagTable fields
					case 'BugIdControl':
						return ($this->txtBugId = QType::Cast($mixValue, 'QControl'));
					case 'TagIdControl':
						return ($this->txtTagId = QType::Cast($mixValue, 'QControl'));
					case 'UserIdControl':
						return ($this->txtUserId = QType::Cast($mixValue, 'QControl'));
					case 'DateAttachedControl':
						return ($this->txtDateAttached = QType::Cast($mixValue, 'QControl'));
					default:
						return parent::__set($strName, $mixValue);
				}
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}
	}
?>